home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Utilities / Calc / calc.1 < prev    next >
Encoding:
Text File  |  1992-02-24  |  6.3 KB  |  258 lines  |  [TEXT/????]

  1. .\"
  2. .\" Copyright (c) 1992 David I. Bell and Landon Curt Noll
  3. .\" Permission is granted to use, distribute, or modify this source,
  4. .\" provided that this copyright notice remains intact.
  5. .\"
  6. .\" calculator by David I. Bell
  7. .\" man page by Landon Noll
  8. .TH calc 1 "^..^" "22jun91"
  9. .SH NAME
  10. \f4calc\f1 \- arbitrary precision calculator
  11. .SH SYNOPSIS
  12. \f4calc\fP
  13. [
  14. \f4\-h\fP
  15. ] [
  16. \f4\-q\fP
  17. ] [
  18. .I calc_cmd
  19. \&.\|.\|.
  20. ]
  21. .SH DESCRIPTION
  22. \&
  23. .br
  24. CALC COMMAND LINE
  25. .PP
  26. .TP
  27. \f4 \-h\f1
  28. Print a help message.
  29. This option implies \f4 \-q\f1.
  30. This is equivalent to the calc command \f4help help\fP.
  31. .TP
  32. \f4 \-q\f1
  33. Disable the use of the \f4$CALCRC\f1 startup library scripts.
  34. .PP
  35. Without \f4calc_cmd\fPs, \f4calc\fP operates interactively.
  36. If one or more \f4calc_cmd\fPs are given on the command line,
  37. \f4calc\fP will execute them and exit.
  38. .PP
  39. Normally on startup, \f4calc\fP attempts to execute a collection 
  40. of library scripts.
  41. The environment variable \f4$CALCRC\f1 (if non-existent then
  42. a compiled in value) contains a \f4:\fP separated list of
  43. startup library scripts.
  44. No error conditions are produced if these startup library scripts
  45. are not found.
  46. .PP
  47. Filenames are subject to ``~'' expansion (see below).
  48. The environment variable \f4$CALCPATH\fP (if non-existent then
  49. a compiled in value) contains a \f4:\fP separated list of search
  50. directories.
  51. If a file does not begin with \f4/\fP, \f4~\fP or \f4./\fP,
  52. then it is searched for under each directory listed in the \f4$CALCPATH\fP.
  53. It is an error if no such readable file is found.
  54. .PP
  55. For more information use the following calc commands:
  56. .PP
  57. .in 1.0i
  58. help usage
  59. .br
  60. help help
  61. .br
  62. help environment
  63. .in -1.0i
  64. .PP
  65. OVERVIEW
  66. .PP
  67. \f4Calc\fP is arbitrary precision arithmetic system that uses 
  68. a C-like language.
  69. \f4Calc\fP is useful as a calculator, an algorithm prototyped
  70. and as a mathematical research tool.
  71. More importantly, \f4calc\fP provides one with a machine
  72. independent means of computation.
  73. .PP
  74. A rich set of builtin functions is provided.
  75. A number of library scripts are also provided because they are
  76. useful and to serve as examples of the \f4calc\fP language.
  77. .PP
  78. One may further extend \f4calc\fP permits further thru to
  79. use of calc library scripts.
  80. Written in the same C-like language, library scripts may be
  81. read in and executed during a \f4calc\fP session.
  82. .PP
  83. Internally calc represents numeric values as fractions reduced to their
  84. lowest terms.
  85. The numerators and denominators of these factions may grow to
  86. arbitrarily large values.
  87. Numeric values read in are automatically converted into rationals.
  88. The user need not be aware of this internal representation.
  89. .PP
  90. For more information use the following calc commands:
  91. .PP
  92. .in 1.0i
  93. help intro
  94. .br
  95. help builtin
  96. .br
  97. help stdlib
  98. .br
  99. help define
  100. .br
  101. show builtins
  102. .br
  103. show functions
  104. .in -1.0i
  105. .PP
  106. DATA TYPES
  107. .PP
  108. Fundamental builtin data types include integers, real numbers, 
  109. rational numbers, complex numbers and strings.
  110. .PP
  111. By use of an object, one may define an arbitrarily complex
  112. data types.
  113. One may define how such objects behave a wide range of
  114. operations such as addition, subtraction,
  115. multiplication, division, negation, squaring, modulus,
  116. rounding, exponentiation, equality, comparison, printing
  117. and so on.
  118. .PP
  119. For more information use the following calc commands:
  120. .PP
  121. .in 1.0i
  122. help types
  123. .br
  124. help obj
  125. .br
  126. show objfuncs
  127. .in -1.0i
  128. .PP
  129. VARIABLES
  130. .PP
  131. Variables in \f4calc\fP are typeless.
  132. In other words, the fundamental type of a variable is determined by its content.
  133. Before variable is assigned a value is of type ``null''.
  134. .PP
  135. The scope of a variable may be global, or only a local to a procedure.
  136. Values may be grouped together in a matrix, or into a
  137. a list that permits stack and queue style operations.
  138. .PP
  139. For more information use the following calc commands:
  140. .PP
  141. .in 1.0i
  142. help variable
  143. .br
  144. help mat
  145. .br
  146. help list
  147. .br
  148. show globals
  149. .in -1.0i
  150. .PP
  151. INPUT/OUTPUT
  152. .PP
  153. A leading ``0x'' implies a hexadecimal value,
  154. a leading ``0b'' implies a binary value,
  155. and a ``0'' followed by a digit implies an octal value.
  156. Complex numbers are indicated by a trailing ``i'' such as in ``3+4i''.
  157. Strings may be delimited by either a pair of single or double quotes.
  158. By default, \f4calc\fP prints values as if they were floating point numbers.
  159. One may change the default to print values in a number of modes
  160. including fractions, integers and exponentials.
  161. .PP
  162. A number of stdio-like file I/O operations are provided.
  163. One may open, read, write, seek and close files.
  164. Filenames are subject to ``\~'' expansion to home directories
  165. in a way similar to that of the Korn or C-Shell.
  166. .PP
  167. For example:
  168. .PP
  169. .in 1.0i
  170. ~/.calcrc
  171. .br
  172. ~chongo/lib/fft_multiply.cal
  173. .in -1.0i
  174. .PP
  175. For more information use the following calc command:
  176. .PP
  177. .in 1.0i
  178. help file
  179. .in -1.0i
  180. .PP
  181. CALC LANGUAGE
  182. .PP
  183. The \f4calc\fP language is a C-like language.
  184. The language includes commands such as variable declarations, 
  185. expressions, tests, labels, loops, file operations, function calls.
  186. These commands are very similar to their counterparts in C.
  187. .PP
  188. The language also include a number of commands particular
  189. to \f4calc\fP itself.
  190. These include commands such as function definition, help, 
  191. reading in library scripts, dump files to a file, error notification, 
  192. configuration control and status.
  193. .PP
  194. For more information use the following calc command:
  195. .PP
  196. .in 1.0i
  197. help command
  198. .br
  199. help statement
  200. .br
  201. help expression
  202. .br
  203. help operator
  204. .br
  205. help config
  206. .in -1.0i
  207. .PP
  208. .SH FILES
  209. .PD 0
  210. .TP 20
  211. ${LIBDIR}
  212. library scripts shipped with calc
  213. .br
  214. .sp
  215. .TP 20
  216. ${LIBDIR}/help
  217. help files
  218. .br
  219. .sp
  220. Typically ${LIBDIR} is /usr/local/lib/calc
  221. .sp
  222. .SH CREDIT
  223. Written by David I. Bell.
  224. .sp
  225. Thanks for suggestions and encouragement from Peter Miller,
  226. Neil Justusson, and Landon Noll.
  227. .sp
  228. Portions of this program are derived from an earlier set of
  229. public domain arbitrarily precision routines which was posted
  230. to the net around 1984.  By now, there is almost no recognizable 
  231. code left from that original source.
  232. .sp
  233. Most of this source and binary is:
  234. .sp
  235. .PP
  236. .in 1.0i
  237. Copyright (c) 1992 David I. Bell
  238. .sp
  239. .in -1.0i
  240. .PP
  241. Some files are a copyrighted David I. Bell and Landon Noll.
  242. .sp
  243. Permission is granted to use, distribute, or modify this source,
  244. provided that this copyright notice remains intact.
  245. .sp
  246. Send calc comments, suggestions, bug fixes, enhancements
  247. and interesting calc scripts that you would like you see included 
  248. in future distributions to:
  249. .sp
  250. .PP
  251. .in 1.0i
  252. dbell@pdact.pd.necisa.oz.au\ \ and\ \ chongo@toad.com
  253. .sp
  254. .in -1.0i
  255. .PP
  256. .sp
  257. Enjoy!
  258.